<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(function(){
	numChange();
	$(".flist").change(function(){
		/* alert($('.flist').val()); */
	});
});

function numChange(){
	$("#apply").click(function(){
		var end = $("#num").val();
		
		$("#files").empty();
		for(var i=0; i<end; i++){
			$("#files").append("<input type='file' class='flist' name='filename"+i+"' /><br />");
		}
	});
};
</script>
</head>
<body>
	<div>
		<header>
		<h1>문서 입력</h1>
		</header>

		<div>
			<form action="albumRegProcess.do" method="post" enctype="multipart/form-data">
				<table>
					<tr>
						<th>태그</th>
						<td><input type="text" name="tag" /></td>
					</tr>
					<tr>
						<th>장소</th>
						<td><input type="text" name="loc" /></td>
					</tr>
					<tr>
						<th>이미지 수</th>
						<td>파일수<input id="num" type="number" />
						<input id="apply" type="button" value="적용" /></td>
					</tr>
					<tr>
						<th>첨부</th>
						<td id="files"><input type="file" class='flist' name="filename" />
						</td>
					</tr>
					<tr>
						<td colspan="2"><textarea cols="95" rows="20" name="content"></textarea></td>
					</tr>
					<tr>
						<td colspan="2">
							<input type="submit" value="저장" /> &nbsp;
						</td>
					</tr>
				</table>
			</form>
		</div>
	</div>
</body>
</html>